[jQuery] Change the content of a cell from another cell

Posted by robs on Stack Overflow See other posts from Stack Overflow or by robs
Published on 2011-01-15T17:41:54Z Indexed on 2011/01/15 17:53 UTC
Read the original article Hit count: 239

Filed under:
|
|

hey, i'm trying to select change the content of a cell with jquery but i cant seem to get it working. lets say we have this table:

<table border="1">
<tr>
<td>cell 1
<td>cell 2
<td>cell 3
<tr>
<td>cell 4
<td>cell 5
<td>cell 6 <a onclick="javascript:$(this).parent().parent().('td').html('test');">Click</a>
<tr>
<td>cell 7
<td>cell 8
<td>cell 9
</table>

i want to change the content of cell 4 from within cell 6. the ('td') obviously isnt working. how can i access cell 4 from cell 6 without the use of classes or ids? thanks in advance

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery